package javase_class_250905;

/**
 * ClassName: Employee
 * Package: javase_class_250905
 * Description:
 *
 * @Author harkjeans
 * @Create 2025/9/5 14:36
 * @Version 1.0
 */
public class Employee {
    private static int total;//这里私有化，在类的外面必须使用get/set方法的方式来访问静态变量
    static String company;//这里缺省权限修饰符，是为了方便类外以“类名.静态变量”的方式访问
    private int id;
    private String name;

    public Employee(){
        total++;
        id = total;//这里用total静态变量的值为id属性赋值
    }
    public Employee(String name){
        this();
        this.name = name;
    }

    public void setId(int id){
        this.id = id;
    }
    public int getId(){
        return id;
    }

    public String getName(){
        return name;
    }
    public void setName(String name){
        this.name = name;
    }

    public static int getTotal(){
        return total;
    }
    public static void setTotal(int total){
        Employee.total = total;
    }

    @Override
    public String toString(){
        return "Employee{company = " + company + ", id = " + id + ", name = " + name + "}";
    }

}
